<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWaimaiShopFinishConfigTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysqlWaiMaiAll')->create('waimai_shop_finish_config', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0)->comment('店铺id');
            $table->unsignedInteger('timeId')->default(0)->comment('waimai_shop_time_config表id');
            $table->unsignedTinyInteger('priceType')->default(0)->comment('1小额订单 2中额订单 3大额订单');
            $table->unsignedInteger('seconds')->default(0)->comment('出餐秒数');

            $table->integer('createdAt')->default(0)->comment('创建时间');
            $table->integer('createdByUid')->default(0)->comment('创建人');
            $table->integer('updatedAt')->default(0)->comment('修改时间');
            $table->integer('updatedByUid')->default(0)->comment('修改人');

            $table->index(['shopId'], 'idx_shopId');
            $table->comment = '外卖店铺自动出餐配置';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysqlWaiMaiAll')->dropIfExists('waimai_shop_finish_config');
    }
}
